<?php 

// 核心文件
// 定义常量
define("COMMON_PATH", "./Xbs/Common");

define("CONF_PATH", "./Xbs/Conf");

define("LIB_PATH", "./Xbs/Lib");

//公共函数库
include COMMON_PATH."/function.php";

//自动加载
function __autoload($classname)
{
	
	$paths = array(
		CONTROLLER_PATH.'/'.$classname.'.class.php',
		MODEL_PATH.'/'.$classname.'.class.php',
		LIB_PATH.'/'.$classname.'.class.php'
		);

	// var_dump($paths);

	foreach ($paths as $path) {
		if(file_exists($path)){
			include $path;
			return;
		}
	}
}

//获取路径上的参加
$module = isset($_GET['m']) ? ucfirst(strtolower($_GET['m'])) : config('DEFALUT_MODULE');

$controller = isset($_GET['c']) ? ucfirst(strtolower($_GET['c'])) : config('DEFALUT_CONTROLLER');

$action = isset($_GET['a']) ? ucfirst(strtolower($_GET['a'])) : config('DEFALUT_ACTION');

// var_dump($module,$controller,$action);

//组路径常量
define("CONTROLLER_PATH",APP_PATH.'/'.$module.'/Controller');

define("MODEL_PATH",APP_PATH.'/'.$module.'/Model');

define("VIEW_PATH",APP_PATH.'/'.$module.'/View');

define("MODULE_NAME",$module);
define("CONTROLLER_NAME",$controller);
define("ACTION_NAME",$action);


// var_dump(CONTROLLER_PATH,MODEL_PATH,VIEW_PATH);


$controller = $controller."Controller";

// var_dump($controller);

$obj = new $controller();

$obj->$action();


















 ?>